<template>
	<view>
		<!-- 轮播图 -->
			<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
				<swiper-item
				v-for="(item,index) in shopData"
				>
					<view class="swiper-item">
						<image :src="item.shop.cover"></image>
					</view>
				</swiper-item>
			</swiper>
		
	</view>
</template>

<script>
	import shop from '@/common/api/shop/shop.js'
	import indexH from '@/common/api/index/index.js'
	export default {
		data() {
			return {
				shopData:[],
				shopIds:[]
			}
		},
		mounted() {
			this.loadIndexShop();
		},
		methods:{
			//加载具体数据
			loadBanner(){
				shop.getShopDataByIds(this.shopIds)
					.then((res)=>{
						this.shopData = res.data.list
					})
			},
			//加载首页数据
			loadIndexShop(){
				indexH.getShopData()
					.then((res) =>{
						this.shopIds = res.data.shopIds;
						this.loadBanner();
					})
			},
			goodDetail(id){
				uni.navigateTo({
					url:'/pages/goodDetail/goodDetail?id='+id
				})
			}
		}
		
	}
</script>

<style>

.swiper{
	width: 100%;
	height: 25%;
	
	image-rendering: -moz-crisp-edges;
	image-rendering: -o-crisp-edges;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	-ms-interpolation-mode: nearest-neighbor;
}
</style>
